﻿Imports System.Data.SqlClient

Public Class ProcFuncDao

    Public Shared Sub ExecuteProcSQL(ByVal sql As String)
        Dim cn As SqlConnection = DataProvider.ConnectioData
        cn.Open()
        Dim cmd As New SqlCommand(sql, cn)
        cmd.ExecuteNonQuery()
        cn.Close()
    End Sub

    Public Shared Function ExecuteFuncSQL(ByVal sql As String) As DataTable
        Dim dt As New DataTable
        Dim cn As SqlConnection = DataProvider.ConnectioData
        cn.Open()
        Dim da As New SqlDataAdapter(sql, cn)
        da.Fill(dt)
        cn.Close()
        Return dt
    End Function

    Public Shared Function ExecuteFuncSQL_SqlDataAdapter(ByVal sql As String) As SqlDataAdapter
        Dim cn As SqlConnection = DataProvider.ConnectioData
        cn.Open()
        Dim da As New SqlDataAdapter(sql, cn)
        cn.Close()
        Return da
    End Function

    Public Shared Function ExecuteFuncSSQL(ByVal sql As String) As Object
        Dim obj As New Object
        Dim cn As SqlConnection = DataProvider.ConnectioData
        cn.Open()
        Dim cmd As New SqlCommand(sql, cn)
        obj = cmd.ExecuteScalar()
        cn.Close()
        Return obj
    End Function

End Class
